<template>
  <div style="padding:30px;">
    <div>
      <el-alert :closable="false" title="数据预览" />
    </div>
    <div style="margin: 20px 0px;">
      <el-button type="primary" size="small" @click="$router.back()">返回</el-button>
      <FormDataRender :data="data"></FormDataRender>
    </div>
  </div>
</template>
<script>
import FormDataRender from '@/components/Form/FormDataRender'
import { initData } from '@/utils/form.em'
import { getData } from '@/api/form'
export default {
  components: {
    FormDataRender
  },
  data() {
    return {
      data: {}
    }
  },
  created() {
    const dataId = this.$route.query.dataId
    if (dataId) {
      getData(dataId).then(data => {
        if (data.res) {
          this.data = initData(data.data)
        }
      })
    }
  }
}
</script>
